<template>
  <div>
    <div class="my-heard">
      <h1>
        <img src="img/Tripadvisor_header.svg" alt="" />
      </h1>
      <div class="heard-right">
        <div style="border: none" class="heard-block">
          <i class="el-icon-edit"></i>
          <span>点评</span>
        </div>
        <div style="border: none" class="heard-block">
          <i class="el-icon-star-off"></i>
          <span>旅行</span>
        </div>
        <!-- 如果用户存在 显示默认照片 -->
        <div style="width: 40px; height: 40px; padding: 0" class="heard-block">
          <img class="btn" src="/detail_f2_img/img_scenic/head.png" />
          <div class="menu">
            <!-- <div @click="goPerson()">个人页面</div> -->
            <div>账号信息</div>
            <div @click="logout">退出</div>
          </div>
        </div>
      </div>
    </div>
    <div class="center">
      <div
        style="margin-bottom: 1px solid #e5e5e5; width: 1280px; margin: 0 auto"
      >
        <el-menu
          text-color="#000"
          :default-active="activeIndex"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
        >
          <el-menu-item index="1">酒店</el-menu-item>
          <el-menu-item index="2">景点体验</el-menu-item>
          <el-menu-item index="3">美食</el-menu-item>
          <el-menu-item index="4">旅行者之选</el-menu-item>
          <el-submenu index="5">
            <template slot="title">···</template>
            <el-menu-item index="2-1">航空公司</el-menu-item>
            <el-menu-item index="2-2">下载app</el-menu-item>
          </el-submenu>
        </el-menu>
      </div>
      <div class="container">
        <div>
          <div class="box">
            <div class="left">
              <span class="img">
                <img src="/detail_f2_img/img_scenic/head.png" alt="" />
              </span>
              <span class="person">
                <div>
                  <h3>{{ $store.state.name }}</h3>
                  <h5>手机号</h5>
                </div>
                <div style="margin-top: 35px">
                  <span style="margin-right: 40px">粉丝</span>
                  <span>已关注</span>
                </div>
              </span>
            </div>
            <div class="right">
              <div class="rightc">
                <span style="margin-right: 20px">编辑简介</span>
                <i class="el-icon-setting"></i>
              </div>
            </div>
          </div>
          <div class="bootom">
            <div class="jieshao">
              <div>简介</div>
            </div>
            <div class="message">
              <div>您的收藏</div>
              <ul>
                <li>
                  <div></div>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  data() {
    return {
      activeIndex: "",
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    ...mapMutations(["logout"]),
    goPerson() {
      this.$router.push("/person");
    },
    logout() {
      window.sessionStorage.clear(); //销毁token
      this.$router.push("/");
    },
  },
};
</script>

<style lang="scss" scoped>
.my-heard {
  box-sizing: border-box;
  width: 1280px;
  margin: 0 auto;
  height: 60px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  img {
    width: 225px;
    height: 66px;
  }
}

.heard-right {
  color: black;
  display: flex;
  cursor: pointer;
  .heard-block {
    display: flex;
    flex-direction: row;
    font-size: 16px;
    font-weight: 700;
    vertical-align: middle;
    padding: 10px 16px;
    margin-left: 8px;
    width: 60px;
    height: 20px;
    border: 1px solid #bbb;
    border-radius: 20px;
    margin-top: 10px;
    position: relative;

    > span {
      margin-left: 5px;
    }
    > i {
      margin-top: 3px;
    }
    .btn {
      width: 40px;
      height: 40px;
      border: none;
      border-radius: 50%;
      &:hover + .menu {
        display: block;
      }
    }
  }
}
.menu {
  display: none;
  z-index: 999;
  position: absolute;
  width: 164px;
  height: 80px;
  background-color: #fff;
  border-radius: 20px;
  top: 35px;
  right: 0px;
  padding: 8px 16px;
  box-sizing: border-box;
  box-shadow: 0 2px 54px rgba(0, 0, 0, 0.1);

  > div {
    padding: 7px;
    font-size: 16px;
    font-weight: normal;
    &:hover {
      background-color: #e1e1e1e1;
    }
  }
}
.center {
  width: 100%;
  background-color: #f2f2f2;
  min-width: 1500px;
}
.container {
  width: 1280px;
  margin: 0 auto;
}
.box {
  padding: 24px;
  margin-top: 20px;
  border: 1px solid #e5e5e5;
  display: flex;
  height: 140px;
  background-color: white;
  justify-content: space-between;
}
.left {
  display: flex;
}
.img {
  width: 118px;
  height: 118px;

  img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }
}
.person {
  margin-left: 40px;
}
.rightc {
  border: 1px solid #d6d6d6;
  padding: 5px 20px;
}
.bootom {
  display: flex;
  margin-top: 20px;
}
.jieshao {
  background-color: #ffffff;
  border: 1px solid #e5e5e5;
  width: 240px;
  height: 98px;
  padding: 24px;
  font-size: 16px;
  color: #000a12;
  margin-right: 20px;
}
.message {
  width: 600px;
  //height: 180px;
  border: 1px solid #e5e5e5;
  padding: 24px;
  color: #000a12;
  font-size: 20px;
  text-align: center;
  background-color: #ffffff;
}
</style>
